package bTree.LeetCode;

import java.util.Arrays;

public class 最长递增子序列 {
    public int lengthOfLIS(int[] nums) {
        int length = nums.length;
        int[]dp=new int[length+1];
        int res=1;
        Arrays.fill(dp,1);
        for (int i=1;i<length;i++){
            int num = nums[i];
            for (int j=0;j<i;j++){
                if (num>nums[j]){
                    dp[i+1]=Math.max(dp[i+1],dp[j+1]+1);
                }
            }
            res=Math.max(res,dp[i+1]);
        }
        return res;
    }
}